/*
 * threadpool.h
 *
 *  Created on: 2012-5-2
 *      Author: epmm
 */

#ifndef THREADPOOL_H_
#define THREADPOOL_H_

class CThreadPool
{
	sem_t m_sem;
	u_int m_nWorkThreadNum;

	CWorkTask m_WorkTask;

public:
	CThreadPool();
	CThreadPool(int threadnum, bool block, int max_queue);
	virtual ~CThreadPool();

public:
	void InitPool(int threadnum, bool block, int max_queue);
	void InitPool();
	int AddWorkJob(CJobBase* pJob);
	CJobBase* GetWorkJob();
	void CreateWorkThread(int nNum);

	friend class CWorkThread;
};

#endif /* THREADPOOL_H_ */
